package away3DExtensions
{
    import away3d.core.base.IRGBABufferRenderable;
    import away3d.core.base.SubGeometry;
    import away3d.core.managers.Stage3DProxy;
    
    import flash.display3D.VertexBuffer3D;
    
    public class ColoredSubGeometry extends SubGeometry implements IRGBABufferRenderable
    {
        protected var _colorBuffer : VertexBuffer3D = null;
        protected var _colorVertices :Vector.<Number> = new Vector.<Number>();
        
        public function ColoredSubGeometry()
        {
            super();
        }

        public function updateRGBAVertices(vertices : Vector.<Number>) : void
        {
            _colorVertices = vertices;
        }

        public function getRGBAVertices() : Vector.<Number>
        {
            return _colorVertices;            
        }
        
        public function getRGBABuffer(stage3DProxy : Stage3DProxy) : VertexBuffer3D
        {
            _colorBuffer = stage3DProxy.context3D.createVertexBuffer(_numVertices, 4);
            _colorBuffer.uploadFromVector(_colorVertices, 0, _numVertices);
            
            return _colorBuffer;
        }
    }
}